toolbar: Handle the fact that size_allocate() != get_allocation()
authorBenjamin Otte <otte@redhat.com>
Wed, 15 Jun 2011 17:59:45 +0000 (19:59 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 15 Jun 2011 18:14:18 +0000 (20:14 +0200)
size_allocate() allocates the available space for the margin box,
get_allocation() returns the actual space of the content box and those
can be different. And then animations never stop.
If that makes you go "huh?", you might want to read
http://www.w3.org/TR/CSS21/box.html
and the docs for gtk_widget_compute_align().

gtk/gtktoolbar.c

index f6549194a7e241c649270b4cc0a61169047892d8..da55c6a988b868d73ea84bf485637c75dbb49aaf 100644 (file)
@@ -3513,8 +3513,20 @@ static void
 toolbar_content_size_allocate (ToolbarContent *content,
                               GtkAllocation  *allocation)
 {
+  GtkAllocation goal;
+
   gtk_widget_size_allocate (GTK_WIDGET (content->item),
                             allocation);
+
+  toolbar_content_get_goal_allocation (content, &goal);
+  if (goal.x == allocation->x && 
+      goal.y == allocation->y && 
+      goal.width == allocation->width && 
+      goal.height == allocation->height)
+    {
+      gtk_widget_get_allocation (GTK_WIDGET (content->item), &goal);
+      toolbar_content_set_goal_allocation (content, &goal);
+    }
 }
 
 static void